<?php
//หากมีการเรียกไฟล์นี้โดยตรง
if (eregi("core.php",$PHP_SELF)) 
{
  Header("Location: index.php");	
  die();
}

//ตรวจสอบว่ามีโมดูลหรือไม่ (โมดูล User)
function GETMODULE($name,$file){
	global $MODPATH, $MODPATHFILE ;
	if(!$name){$name = "index";}
	if(!$file){$file = "index";}
	$modpathfile= $name."/".$file.".php";
	if (file_exists($modpathfile)) {
		$MODPATHFILE = $modpathfile;
		$MODPATH = $name."/";
		}else{
		die ("เสียใจด้วยครับ ไม่มีหน้าที่ท่านต้องการเข้าชม...<br>	รอสักครู่ ระบบจะนำท่านกลับไปยังหน้าหลัก...<br> <meta http-equiv='refresh' content='3;url=../index.php'>");//404
	}
}

require_once("includes/config.in.php");
require_once("includes/class.mysql.php");
// require_once("libraries/facebook.php");

$db = new DB();
// $fb = new Facebook(array(
//   'appId'  => '170579709711779',
//   'secret' => '49c53da66164d114b1f35ec6b13f83d6',
// ));

$db->connectdb(DB_NAME,DB_USERNAME,DB_PASSWORD);
require_once("includes/function.in.php");

// // Check login cookie
// // check_session($_SESSION['current_user']);

// $user = $fb->getUser();

// // We may or may not have this data based on whether the user is logged in.
// //
// // If we have a $user id here, it means we know the user is logged into
// // Facebook, but we don't know if the access token is valid. An access
// // token is invalid if the user logged out of Facebook.
// $profile = null;
// if($user)
// {
// 	try {
// 			// Proceed knowing you have a logged in user who's authenticated.
// 		$profile = $fb->api('/me?fields=id,name,link,email,user_photos,publish_actions,user_location,user_likes,user_birthday,publish_stream,offline_access');
// 	} catch (FacebookApiException $e) {
// 		error_log($e);
// 		$user = null;
// 	}		
// }

// $fb_data = array(	'me' => $profile,
// 									'uid' => $user,
// 									'fan' => $fb->getSignedRequest(),
// 									'loginUrl' => $fb->getLoginUrl(),
// 									'logoutUrl' => $fb->getLogoutUrl(),
// 								);

?>